package com.power.sifa.approve.model;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.plf.core.common.annotations.FieldEnumText;
import com.plf.core.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
*  送达信息实体类
*/

@Entity
@ApiModel(value="送达信息")
@Data
@Table(name="Apl_arrive",schema="sfapprove")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
//@IdClass(Apl_arrive.Apl_arrivePK.class) 用于复合组件
public class Apl_arrive extends BaseModel implements Serializable {

	private static final long serialVersionUID = 1L;

    @Id
    @Setter(AccessLevel.NONE)
    @ApiModelProperty(value = "applyid")
    private String id;

    @ApiModelProperty(value = "受送达人")
    private String name;

    @ApiModelProperty(value = "身份证号码")
    private String cardno;

    @ApiModelProperty(value = "邮寄地址")
    private String addr;

    @ApiModelProperty(value = "收件人")
    private String recipient;

    @ApiModelProperty(value = "移动电话")
    private String mobile;

    @ApiModelProperty(value = "电子邮件")
    private String email;

    @ApiModelProperty(value = "邮政编码")
    private String postcode;

    @ApiModelProperty(value = "其他联系方式（QQ、微信）")
    private String other;

    /**
     * 受送达人--申请人
     * 受送达人 -可以为申请人 也可以为代理人
     */
    @Transient
    private Apl_applicant applicant;

    /**
     * 受送达人--代理人
     * 受送达人 -可以为申请人 也可以为代理人
     */
    @Transient
    private Apl_agent agent;


    public Map<String, Object> parseMap() {
        Map<String, Object> map=new HashMap<>();
        map.put("id", this.getId());
        map.put("name", this.getName());
        map.put("cardno", this.getCardno());
        map.put("addr", this.getAddr());
        map.put("recipient", this.getRecipient());
        map.put("mobile", this.getMobile());
        map.put("email", this.getEmail());
        map.put("postcode", this.getPostcode());
        map.put("other", this.getOther());
        return map;
    }

    public String getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = (String) id;
    }

    public Serializable getPrimaryKey() {
        return id;
        // return new Apl_arrivePK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.id = (String)key;

        //Apl_arrivePK pk = (Apl_arrivePK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}
